# 使用 cmake -P main.cmake 执行对应.cmake文件
cmake_minimum_required(VERSION 3.20)

# list(APPEND <list> [<element>..])：列表添加元素
# list(REMOVE_ITEM <list> <value> [value...])：列表删除元素
# list(LENGTH <list> <output variable>)：获取列表元素个数
# list(FIND <list> <value> <out-var>)：在列表中查找元素返回索引
# list(INSERT <list> <index> [<element>...])：在 index 位置插入
# list(REVERSE <list>)：反转 list
# list(SORT <list> [...])：排序 list


# 1、定义list
set(list 1 2 3)
message("list is " ${list})
list(APPEND arr a b c)
message("arr is " ${arr})


list(LENGTH arr len)
message("arr's len is " ${len})

list(FIND arr b index)
message("a in arr index is " ${index})

message("list  before REMOVE_ITEM 1 is " ${list})
list(REMOVE_ITEM list 1)
message("list  after REMOVE_ITEM 1 is " ${list})

message("arr INSERT d before is " ${arr})
list(INSERT arr 3 d)
message("arr INSERT d after is " ${arr})

list(REVERSE arr)
message("arr REVERSE  is " ${arr})

list(SORT arr)
message("arr SORT  is " ${arr})
